package com.bone.payment.dao;

import java.util.List;
import java.util.Map;

import com.bone.common.BaseIbatisDAO;
import com.bone.page.Page;
import com.bone.payment.po.PayGateway;
import com.bone.payment.po.PayPayment;


/**
 * DAO.
 * @author liwenzhan
 *
 */
public class PayGatewayDAO extends BaseIbatisDAO {
 
	/**
	 * 取符合查询条件的交易记录个数.
	 * @param para
	 * @return
	 */
	public Long queryGatewayCountByParam(Map<String, Object> para){
		return (Long) getSqlMapClientTemplate().queryForObject("PAY_GATEWAY.queryGatewayCountByParam", para);
	}
	/**
	 * 取符合查询条件的交易记录数据.
	 * @param para
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public List<PayPayment> queryGatewayPageByParam(Map<String, Object> para){
		return getSqlMapClientTemplate().queryForList("PAY_GATEWAY.queryGatewayPageByParam",para);
	}
	/**
	 * 支付交易记录.
	 * @param parameter
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public List<PayPayment> queryGatewayListByParam(Map<String, Object> para){
		return getSqlMapClientTemplate().queryForList("PAY_GATEWAY.queryGatewayListByParam",para);
	}
	
	
	/**
	 * 保存网关记录..
	 * @param payment
	 * @return
	 */
	public boolean insertGateway(PayGateway gateway){
		 getSqlMapClientTemplate().insert("PAY_GATEWAY.insert", gateway);
		return true;
	}
	
	/**
	 * 修改网关记录.
	 * @param payment
	 * @return
	 */
	public boolean updateGateway(PayGateway gateway){
		 getSqlMapClientTemplate().update("PAY_GATEWAY.update", gateway);
		return true;
	}
	
 
	/**
	 * 根据网关ID取网关信息.
	 * @param gatewayId
	 * @return
	 */
	public PayGateway queryGatewayById(Long gatewayId){
		return (PayGateway)getSqlMapClientTemplate().queryForObject("PAY_GATEWAY.queryGatewayById", gatewayId);
		
	}
	
	
}
